package com.snj.test;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.LocalTime;

public class TimeDifference {
    public static void main(String[] args) {
        // 获取当前时间
        LocalDateTime now = LocalDateTime.now();

        // 获取当天10点14分
        LocalDateTime today10_14 = LocalDateTime.of(now.toLocalDate(), LocalTime.of(14, 51));

        // 计算时间差
        Duration duration = Duration.between(today10_14, now);

        long hours = duration.toHours();
        long minutes = duration.toMinutes() % 60;

        System.out.println("当前时间与当天10点14分的时间差是: " + hours + "小时" + minutes + "分钟");
    }
}